```html
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>MyBatis 核心对象解析 | 技术小馆</title>
    <link rel="stylesheet" href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css">
    <link rel="stylesheet" href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        :root {
            --primary: #4F46E5;
            --primary-light: #6366F1;
            --secondary: #10B981;
            --dark: #1E293B;
            --light: #F8FAFC;
            --gray: #64748B;
            --muted: #94A3B8;
        }
        
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            color: var(--dark);
            line-height: 1.6;
            background-color: #f9fafb;
        }
        
        h1, h2, h3, h4 {
            font-family: 'Noto Serif SC', serif;
            font-weight: 600;
            color: var(--dark);
        }
        
        .hero {
            background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
        }
        
        .card {
            transition: all 0.3s ease;
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
        }
        
        .card:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
        }
        
        .code-block {
            background-color: #2d3748;
            color: #f8fafc;
            border-radius: 0.375rem;
            position: relative;
        }
        
        .code-block::before {
            content: attr(data-lang);
            position: absolute;
            top: 0;
            right: 0;
            background-color: rgba(255, 255, 255, 0.1);
            color: var(--muted);
            padding: 0.25rem 0.75rem;
            font-size: 0.75rem;
            border-bottom-left-radius: 0.375rem;
            border-top-right-radius: 0.375rem;
        }
        
        .list-item {
            position: relative;
            padding-left: 1.5rem;
        }
        
        .list-item::before {
            content: "";
            position: absolute;
            left: 0;
            top: 0.6em;
            width: 0.5rem;
            height: 0.5rem;
            border-radius: 50%;
            background-color: var(--primary);
        }
        
        .divider {
            height: 1px;
            background: linear-gradient(to right, transparent, rgba(100, 116, 139, 0.2), transparent);
        }
    </style>
</head>
<body class="antialiased">
    <!-- Hero Section -->
    <section class="hero text-white py-20 px-4 md:px-0">
        <div class="container mx-auto max-w-4xl text-center">
            <div class="inline-block px-3 py-1 mb-4 text-sm font-semibold text-indigo-100 bg-white/20 rounded-full">
                <i class="fas fa-database mr-1"></i> Java 持久层框架
            </div>
            <h1 class="text-4xl md:text-5xl font-bold mb-6">MyBatis 核心对象解析</h1>
            <p class="text-xl md:text-2xl opacity-90 max-w-3xl mx-auto leading-relaxed">
                MyBatis 通过一组精心设计的核心对象，简化了数据库交互的复杂性，为开发者提供了高效灵活的数据持久化方案。
            </p>
            <div class="mt-10">
                <a href="#core-objects" class="inline-flex items-center px-6 py-3 border border-transparent text-base font-medium rounded-md text-indigo-700 bg-white hover:bg-gray-50 transition-colors duration-200 shadow-sm">
                    探索核心对象 <i class="fas fa-arrow-down ml-2"></i>
                </a>
            </div>
        </div>
    </section>

    <!-- Main Content -->
    <main class="container mx-auto max-w-5xl px-4 md:px-6 py-12">
        <!-- Introduction -->
        <section class="mb-16">
            <div class="prose-lg max-w-4xl mx-auto">
                <p class="text-gray-700 mb-6">
                    MyBatis 是一个流行的持久层框架，它通过简化与数据库的交互，使得 Java 开发人员可以更加高效地进行数据持久化操作。为了实现这种高效性，MyBatis 提供了一组核心对象，每个对象在 MyBatis 的工作机制中都有其独特的角色和作用。
                </p>
            </div>
        </section>

        <!-- Core Objects Section -->
        <section id="core-objects" class="mb-20">
            <h2 class="text-3xl font-bold mb-8 text-center">
                <span class="relative inline-block">
                    <span class="absolute inset-0 bg-indigo-100 opacity-50 -bottom-1 -left-2 -right-2 transform -skew-x-3"></span>
                    <span class="relative z-10">MyBatis 核心对象</span>
                </span>
            </h2>

            <!-- SqlSessionFactory Card -->
            <div class="card bg-white rounded-xl p-6 mb-8">
                <div class="flex items-start mb-4">
                    <div class="flex-shrink-0 h-12 w-12 rounded-lg bg-indigo-100 text-indigo-600 flex items-center justify-center mr-4">
                        <i class="fas fa-factory text-2xl"></i>
                    </div>
                    <div>
                        <h3 class="text-2xl font-bold">1. SqlSessionFactory</h3>
                        <p class="text-gray-600">工厂模式的核心实现，用于创建 SqlSession</p>
                    </div>
                </div>
                
                <div class="grid md:grid-cols-2 gap-6">
                    <div>
                        <h4 class="font-semibold text-lg text-gray-800 mb-3 flex items-center">
                            <i class="fas fa-tasks mr-2 text-indigo-500"></i> 作用
                        </h4>
                        <ul class="space-y-3">
                            <li class="list-item"><span class="font-medium">创建 SqlSession 对象：</span> SqlSessionFactory 是一个工厂对象，它用于创建 SqlSession 对象。SqlSession 是 MyBatis 执行 SQL 操作的关键对象。</li>
                            <li class="list-item"><span class="font-medium">管理资源：</span> SqlSessionFactory 在整个应用程序中应该是单例的，因为它的创建是相对昂贵的操作。</li>
                        </ul>
                    </div>
                    
                    <div>
                        <h4 class="font-semibold text-lg text-gray-800 mb-3 flex items-center">
                            <i class="fas fa-code mr-2 text-indigo-500"></i> 实现细节
                        </h4>
                        <p class="mb-4">SqlSessionFactory 的创建通常是通过 MyBatis 提供的 SqlSessionFactoryBuilder 对象来实现的。</p>
                        <div class="code-block overflow-x-auto p-4 text-sm" data-lang="java">
                            <pre><code>InputStream inputStream = Resources.getResourceAsStream("mybatis-config.xml");
SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream);</code></pre>
                        </div>
                    </div>
                </div>
            </div>

            <!-- SqlSession Card -->
            <div class="card bg-white rounded-xl p-6 mb-8">
                <div class="flex items-start mb-4">
                    <div class="flex-shrink-0 h-12 w-12 rounded-lg bg-blue-100 text-blue-600 flex items-center justify-center mr-4">
                        <i class="fas fa-window-restore text-2xl"></i>
                    </div>
                    <div>
                        <h3 class="text-2xl font-bold">2. SqlSession</h3>
                        <p class="text-gray-600">执行数据库操作的核心接口</p>
                    </div>
                </div>
                
                <div class="grid md:grid-cols-2 gap-6">
                    <div>
                        <h4 class="font-semibold text-lg text-gray-800 mb-3 flex items-center">
                            <i class="fas fa-tasks mr-2 text-blue-500"></i> 作用
                        </h4>
                        <ul class="space-y-3">
                            <li class="list-item"><span class="font-medium">执行数据库操作：</span> SqlSession 是 MyBatis 执行数据库操作的关键接口，它提供了执行 SQL 命令的方法。</li>
                            <li class="list-item"><span class="font-medium">事务管理：</span> SqlSession 提供了事务的开启、提交和回滚功能。</li>
                        </ul>
                    </div>
                    
                    <div>
                        <h4 class="font-semibold text-lg text-gray-800 mb-3 flex items-center">
                            <i class="fas fa-code mr-2 text-blue-500"></i> 实现细节
                        </h4>
                        <p class="mb-4">SqlSession 的生命周期应该是短暂的，通常是方法级的。通过 SqlSession 可以访问 Mapper 接口。</p>
                        <div class="code-block overflow-x-auto p-4 text-sm" data-lang="java">
                            <pre><code>try (SqlSession session = sqlSessionFactory.openSession()) {
    UserMapper mapper = session.getMapper(UserMapper.class);
    User user = mapper.getUserById(1);
}</code></pre>
                        </div>
                    </div>
                </div>
            </div>

            <!-- Mapper 接口 Card -->
            <div class="card bg-white rounded-xl p-6 mb-8">
                <div class="flex items-start mb-4">
                    <div class="flex-shrink-0 h-12 w-12 rounded-lg bg-green-100 text-green-600 flex items-center justify-center mr-4">
                        <i class="fas fa-file-contract text-2xl"></i>
                    </div>
                    <div>
                        <h3 class="text-2xl font-bold">3. Mapper 接口</h3>
                        <p class="text-gray-600">定义数据库操作的抽象层</p>
                    </div>
                </div>
                
                <div class="grid md:grid-cols-2 gap-6">
                    <div>
                        <h4 class="font-semibold text-lg text-gray-800 mb-3 flex items-center">
                            <i class="fas fa-tasks mr-2 text-green-500"></i> 作用
                        </h4>
                        <ul class="space-y-3">
                            <li class="list-item"><span class="font-medium">定义数据库操作：</span> Mapper 接口定义了所有与数据库交互的方法。</li>
                            <li class="list-item"><span class="font-medium">实现隔离：</span> 将 SQL 映射与 Java 代码分离，提供了更清晰的抽象层。</li>
                        </ul>
                    </div>
                    
                    <div>
                        <h4 class="font-semibold text-lg text-gray-800 mb-3 flex items-center">
                            <i class="fas fa-code mr-2 text-green-500"></i> 实现细节
                        </h4>
                        <p class="mb-4">每个 Mapper 接口与一个 XML 映射文件关联，MyBatis 会在运行时动态创建实现类。</p>
                        <div class="code-block overflow-x-auto p-4 text-sm" data-lang="java">
                            <pre><code>public interface UserMapper {
    User getUserById(int id);
    void insertUser(User user);
}</code></pre>
                        </div>
                    </div>
                </div>
            </div>

            <!-- Configuration Card -->
            <div class="card bg-white rounded-xl p-6 mb-8">
                <div class="flex items-start mb-4">
                    <div class="flex-shrink-0 h-12 w-12 rounded-lg bg-purple-100 text-purple-600 flex items-center justify-center mr-4">
                        <i class="fas fa-cog text-2xl"></i>
                    </div>
                    <div>
                        <h3 class="text-2xl font-bold">4. Configuration</h3>
                        <p class="text-gray-600">MyBatis 的全局配置中心</p>
                    </div>
                </div>
                
                <div class="grid md:grid-cols-2 gap-6">
                    <div>
                        <h4 class="font-semibold text-lg text-gray-800 mb-3 flex items-center">
                            <i class="fas fa-tasks mr-2 text-purple-500"></i> 作用
                        </h4>
                        <ul class="space-y-3">
                            <li class="list-item"><span class="font-medium">全局配置管理：</span> 持有 MyBatis 全局配置的所有信息。</li>
                            <li class="list-item"><span class="font-medium">提供配置API：</span> 使开发人员可以在不使用 XML 配置文件的情况下配置 MyBatis。</li>
                        </ul>
                    </div>
                    
                    <div>
                        <h4 class="font-semibold text-lg text-gray-800 mb-3 flex items-center">
                            <i class="fas fa-code mr-2 text-purple-500"></i> 实现细节
                        </h4>
                        <p class="mb-4">Configuration 在 SqlSessionFactory 的创建过程中被初始化。</p>
                        <div class="code-block overflow-x-auto p-4 text-sm" data-lang="java">
                            <pre><code>Configuration config = new Configuration();
config.addMapper(UserMapper.class);
SqlSessionFactory sqlSessionFactory = 
    new SqlSessionFactoryBuilder().build(config);</code></pre>
                        </div>
                    </div>
                </div>
            </div>

            <!-- Executor Card -->
            <div class="card bg-white rounded-xl p-6 mb-8">
                <div class="flex items-start mb-4">
                    <div class="flex-shrink-0 h-12 w-12 rounded-lg bg-red-100 text-red-600 flex items-center justify-center mr-4">
                        <i class="fas fa-bolt text-2xl"></i>
                    </div>
                    <div>
                        <h3 class="text-2xl font-bold">5. Executor</h3>
                        <p class="text-gray-600">SQL 语句执行的核心引擎</p>
                    </div>
                </div>
                
                <div class="grid md:grid-cols-2 gap-6">
                    <div>
                        <h4 class="font-semibold text-lg text-gray-800 mb-3 flex items-center">
                            <i class="fas fa-tasks mr-2 text-red-500"></i> 作用
                        </h4>
                        <ul class="space-y-3">
                            <li class="list-item"><span class="font-medium">执行 SQL 语句：</span> 负责具体的 SQL 语句执行、缓存维护、事务管理等核心任务。</li>
                            <li class="list-item"><span class="font-medium">提供不同类型的执行器：</span> 包括简单执行器、批量执行器和可重用执行器等。</li>
                        </ul>
                    </div>
                    
                    <div>
                        <h4 class="font-semibold text-lg text-gray-800 mb-3 flex items-center">
                            <i class="fas fa-code mr-2 text-red-500"></i> 实现细节
                        </h4>
                        <p class="mb-4">Executor 在内部封装了与数据库的低级交互细节，并负责管理缓存的生命周期。</p>
                        <div class="bg-gray-50 p-4 rounded-lg">
                            <p class="text-gray-700 italic">Executor 是 MyBatis 内部使用的核心组件，通常开发者不需要直接与其交互。</p>
                        </div>
                    </div>
                </div>
            </div>

            <!-- MappedStatement Card -->
            <div class="card bg-white rounded-xl p-6">
                <div class="flex items-start mb-4">
                    <div class="flex-shrink-0 h-12 w-12 rounded-lg bg-yellow-100 text-yellow-600 flex items-center justify-center mr-4">
                        <i class="fas fa-map-marked-alt text-2xl"></i>
                    </div>
                    <div>
                        <h3 class="text-2xl font-bold">6. MappedStatement</h3>
                        <p class="text-gray-600">SQL 映射的元数据容器</p>
                    </div>
                </div>
                
                <div class="grid md:grid-cols-2 gap-6">
                    <div>
                        <h4 class="font-semibold text-lg text-gray-800 mb-3 flex items-center">
                            <i class="fas fa-tasks mr-2 text-yellow-500"></i> 作用
                        </h4>
                        <ul class="space-y-3">
                            <li class="list-item"><span class="font-medium">映射 SQL 语句：</span> 表示 SQL 映射的对象，包含执行 SQL 所需的所有信息。</li>
                            <li class="list-item"><span class="font-medium">管理 SQL 参数和结果映射：</span> 定义了 SQL 参数的绑定方式以及结果的映射方式。</li>
                        </ul>
                    </div>
                    
                    <div>
                        <h4 class="font-semibold text-lg text-gray-800 mb-3 flex items-center">
                            <i class="fas fa-code mr-2 text-yellow-500"></i> 实现细节
                        </h4>
                        <p class="mb-4">每个 SQL 语句在 MyBatis 中对应一个 MappedStatement。</p>
                        <div class="code-block overflow-x-auto p-4 text-sm" data-lang="xml">
                            <pre><code>&lt;select id="getUserById" parameterType="int" resultType="User"&gt;
    SELECT * FROM users WHERE id = #{id}
&lt;/select&gt;</code></pre>
                        </div>
                    </div>
                </div>
            </div>
        </section>

        <!-- Relationship Diagram -->
        <section class="mb-20">
            <h2 class="text-3xl font-bold mb-8 text-center">
                <span class="relative inline-block">
                    <span class="absolute inset-0 bg-indigo-100 opacity-50 -bottom-1 -left-2 -right-2 transform -skew-x-3"></span>
                    <span class="relative z-10">MyBatis 核心对象的关系</span>
                </span>
            </h2>
            
            <div class="bg-white rounded-xl p-6 shadow-sm">
                <div class="mermaid">
                    graph LR
                    A[SqlSessionFactory] -->|创建| B[SqlSession]
                    C[Configuration] -->|初始化| A
                    B -->|使用| D[Executor]
                    D -->|获取| E[MappedStatement]
                    B -->|生成| F[Mapper 接口]
                    F -->|调用| E
                </div>
                <div class="mt-6 grid md:grid-cols-2 gap-6">
                    <div class="bg-gray-50 p-4 rounded-lg">
                        <h4 class="font-semibold text-lg text-gray-800 mb-3 flex items-center">
                            <i class="fas fa-project-diagram mr-2 text-indigo-500"></i> 关系说明
                        </h4>
                        <ul class="space-y-2">
                            <li class="list-item">SqlSessionFactory 是构建 SqlSession 的工厂对象</li>
                            <li class="list-item">SqlSession 使用 Executor 来执行数据库操作</li>
                            <li class="list-item">Executor 依赖于 MappedStatement 来获取 SQL 信息</li>
                            <li class="list-item">Mapper 接口由 SqlSession 生成并调用对应的 SQL 操作</li>
                        </ul>
                    </div>
                    <div class="bg-indigo-50 p-4 rounded-lg">
                        <h4 class="font-semibold text-lg text-indigo-800 mb-3 flex items-center">
                            <i class="fas fa-lightbulb mr-2 text-indigo-600"></i> 设计要点
                        </h4>
                        <p class="text-indigo-700">
                            MyBatis 通过这种分层设计实现了职责分离，每个组件都有明确的边界和职责，这使得框架既灵活又易于扩展。开发者可以根据需要自定义或扩展其中的某些组件（如 Executor）。
                        </p>
                    </div>
                </div>
            </div>
        </section>

        <!-- Key Takeaways -->
        <section class="bg-indigo-50 rounded-xl p-8 mb-12">
            <h2 class="text-2xl font-bold mb-6 text-indigo-800 flex items-center">
                <i class="fas fa-star mr-3"></i> 关键要点总结
            </h2>
            <div class="grid md:grid-cols-2 gap-6">
                <div>
                    <div class="flex items-start mb-4">
                        <div class="flex-shrink-0 h-10 w-10 rounded-full bg-white text-indigo-600 flex items-center justify-center mr-3 shadow-sm">
                            <i class="fas fa-check"></i>
                        </div>
                        <div>
                            <h4 class="font-semibold text-gray-800">工厂模式的应用</h4>
                            <p class="text-gray-600">SqlSessionFactory 采用工厂模式创建 SqlSession，隐藏了创建细节</p>
                        </div>
                    </div>
                    <div class="flex items-start mb-4">
                        <div class="flex-shrink-0 h-10 w-10 rounded-full bg-white text-indigo-600 flex items-center justify-center mr-3 shadow-sm">
                            <i class="fas fa-check"></i>
                        </div>
                        <div>
                            <h4 class="font-semibold text-gray-800">接口与实现分离</h4>
                            <p class="text-gray-600">Mapper 接口与实现分离，提高了代码的可维护性</p>
                        </div>
                    </div>
                </div>
                <div>
                    <div class="flex items-start mb-4">
                        <div class="flex-shrink-0 h-10 w-10 rounded-full bg-white text-indigo-600 flex items-center justify-center mr-3 shadow-sm">
                            <i class="fas fa-check"></i>
                        </div>
                        <div>
                            <h4 class="font-semibold text-gray-800">生命周期管理</h4>
                            <p class="text-gray-600">不同组件有明确的生命周期，如 SqlSessionFactory 是单例而 SqlSession 是短生命周期的</p>
                        </div>
                    </div>
                    <div class="flex items-start">
                        <div class="flex-shrink-0 h-10 w-10 rounded-full bg-white text-indigo-600 flex items-center justify-center mr-3 shadow-sm">
                            <i class="fas fa-check"></i>
                        </div>
                        <div>
                            <h4 class="font-semibold text-gray-800">灵活的扩展点</h4>
                            <p class="text-gray-600">通过插件机制可以扩展 Executor 等核心组件</p>
                        </div>
                    </div>
                </div>
            </div>
        </section>
    </main>

    <!-- Footer -->
    <footer class="bg-gray-900 text-gray-300 py-8">
        <div class="container mx-auto max-w-5xl px-4 md:px-6">
            <div class="flex flex-col md:flex-row justify-between items-center">
                <div class="mb-4 md:mb-0">
                    <h3 class="text-xl font-bold text-white mb-1">技术小馆</h3>
                    <p class="text-gray-400">深入探索技术原理与实践</p>
                </div>
                <div>
                    <a href="http://www.yuque.com/jtostring" class="inline-flex items-center px-4 py-2 border border-gray-700 rounded-md text-gray-300 hover:text-white hover:border-indigo-500 transition-colors duration-200">
                        <i class="fas fa-external-link-alt mr-2"></i> 访问语雀空间
                    </a>
                </div>
            </div>
            <div class="mt-8 pt-6 border-t border-gray-800 text-center text-sm text-gray-500">
                &copy; 2023 技术小馆. 保留所有权利.
            </div>
        </div>
    </footer>

    <script>
        // Initialize Mermaid
        mermaid.initialize({
            startOnLoad: true,
            theme: 'default',
            flowchart: {
                useMaxWidth: true,
                htmlLabels: true,
                curve: 'basis'
            }
        });
        
        // Smooth scrolling for anchor links
        document.querySelectorAll('a[href^="#"]').forEach(anchor => {
            anchor.addEventListener('click', function (e) {
                e.preventDefault();
                
                document.querySelector(this.getAttribute('href')).scrollIntoView({
                    behavior: 'smooth'
                });
            });
        });
    </script>
</body>
</html>
```